/*
 * @lc app=leetcode.cn id=1 lang=javascript
 *
 * [1] 两数之和
 */

// @lc code=start
/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 */
var twoSum = function(nums, target) {
  let map = new Map()
  for(let i = 0; i< nums.length; i++) {
    let t = target - nums[i]
    if (map.hasOwnProperty(t)) {
      return [map[t], i]
    } 
    map[nums[i]] = i 
  }
};
// @lc code=end

